import Vue from 'vue'
import dialog from './co-dialog'

const Dialog = Vue.extend(dialog)

export const createDialog = (option) => {
  return new Promise((resolve, reject) => {
    let instance = new Dialog({
      data () {
        return {
          title: option.title,
          message: option.message
        }
      },
      methods: { resolve, reject }
    })
    let $el = instance.$mount().$el
    document.body.appendChild($el)
  })
}
